<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link type="text/css" rel="stylesheet" href="__PUBLIC__/web/css/lib.css?2">
	<link rel="stylesheet" href="__PUBLIC__/web/js/morris.css">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
	<meta content="telephone=no" name="format-detection">
	<title>Trading Center</title>
	<script src="__PUBLIC__/web/js/jquery-1.8.3.min.js"></script>
	<link rel="stylesheet" href="__PUBLIC__/web/css/weui.min.css"/>
	<link rel="stylesheet" href="__PUBLIC__/web/css/jquery-weui.min.css">
	<link href="__PUBLIC__/web/css/font-awesome.min.css" rel="stylesheet">
	<link href="__PUBLIC__/web/fonts/iconfont.css" rel="stylesheet">
	<script src="__PUBLIC__/web/js/layer.js"></script>
	<link rel="stylesheet" href="__PUBLIC__/web/css/style.css"/>
	<style>
        #lineType{
            width: 100%;
            height: 30px;
            background: #EFEFF4;
        }
        #lineType a{
            float: left;
            width: 25%;
            line-height: 30px;
            -ms-text-align-last: center;
            text-align-last: center;
            color: #666666;
        }
        #lineType a:hover,#lineType a.active{
            background: #04B5A3;
            color: #fff;
            -webkit-transform: all 0.3s;
            -moz-transform: all 0.3s;
            -ms-transform: all 0.3s;
            -o-transform: all 0.3s;
            transform: all 0.3s;
        }
    </style>
</head>
<body>
	<!--顶部开始-->
	<div class="header">
		<span class="header_l"><a href="javascript:history.go(-1);"><i class="fa fa-chevron-left"></i></a></span>
		<span class="header_c">Trading Center</span>
		<span style="position: absolute;right: 10%;top: 0px;text-align:center;width:20%;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;font-size: 12px; ">{$userData['ue_truename']}</span>
		<span class="header_r"><a href="/index.php/Home/Index/enindex/"><i class="fa fa-user"></i></a></span>
	</div>
	<div class="height40"></div>
<section class="content">
    <div class="row">
        <div class="col-md-13">
            <div class="box box-info">
                <div class="box-header with-border">
                    <h3 class="box-title" style="color: #333;/* background: #05b6a3; */ text-align: center;border-bottom: 1px solid #ddd;border-top: 1px solid #ddd;font-size: 18px;padding: 10px 0;">The price chart</h3>
                </div>
                <div id="lineType">
                    <a href="javascript:void(0)" data-id="1" class="type active">Time-sharing line</a>
                    <a href="javascript:void(0)" data-id="2" class="type">Data K</a>
                    <a href="javascript:void(0)" data-id="3" class="type">Week K</a>
                    <a href="javascript:void(0)" data-id="4" class="type">Year k</a>
                </div>
                <div class="box-body chart-responsive" >
                    <!--<div class="box-body chart-responsive" style="background-image: url('__PUBLIC__/user2/images/kx.png');">-->
                    <div id="main" style="width:100%;height:300px;"></div>
                </div>
            </div>
        </div>
    </div>
</section>
	<!--顶部结束-->
	<!--矿车列表-->
	<div style="width: 90%;margin-left: 5%;margin-top: 20px;overflow:hidden;border-radius:5px">
		<p id="qiugou_list"onclick='showhidediv("qiugou")'style="float: left;width: 50%;text-align: center;background-color: #05B6A3;height: 30px;line-height: 30px;color:#fff;border-bottom-left-radius: 5px;border-top-left-radius: 5px">Buy GEC</p>
		<p id="chushou_list" onclick='showhidediv("chushou")'style="float: left;width: 50%;text-align: center;background-color: #fff;height: 30px;line-height: 30px;border-top-right-radius: 5px;border-bottom-right-radius: 5px">Sell GEC</p>
	</div>
	<div id="qiugou" style="padding-bottom:50px;background-color:#fff;margin-top:0px;width:100%;margin-left:0%">
	<form id="qiugou"style="margin-top: 25px" action="/index.php/Home/Info/enmyjiaoyis" method= "POST">
		<input type="text" name="lkb" placeholder="Please enter a quantity to purchase"style="width:60%"/>
		<input type="text" name="price" placeholder="Please enter the purchase price"style="width:60%"/>
		<button type="submit"style="float:right;width:33%;margin-top:-20px;background-color: #04B5A3;height: 30px;line-height: 30px;background-color: #04B5A3;height: 30px;line-height: 30px;border-radius:5px;border:0px;color:#fff">Buy</button>
	</form>
	<table class="jyzx_list" style="margin-top:20px;margin-bottom:80px;border-collapse:collapse;table-layout: fixed">
		<thead>
			<tr style="width:100%;">
				<th style="padding:10px 0">nickname</th>
				<th style="padding:10px 0">Level</th>
				<th style="padding:10px 0;width:20%">GEC</th>
				<th style="padding:10px 0;">total price($)</th>
				<th style="padding:10px 0">state</th>
			</tr>
		</thead>
		<tbody>
		<foreach name="list" item="v">
			<tr style="margin-bottom:100px">
				<td class="name" style="padding:10px 0;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space: nowrap;">{$v.p_name}</td>
				<td class="range iconfont" style="padding:10px 0;text-align:center;">
					<if condition = "$v.p_level eq 0">&#xe667;</if>
					<if condition = "$v.p_level eq 1">&#xe668;</if>
					<if condition = "$v.p_level eq 2">&#xe669;</if>
					<if condition = "$v.p_level eq 3">&#xe66a;</if>
					<if condition = "$v.p_level eq 4">&#xe64f;</if>
					<if condition = "$v.p_level eq 5">&#xe66c;</if>
					<if condition = "$v.p_level eq 6">&#xe66d;</if>


				</td>
				<td class="lkMoney" style="padding:10px 0;text-align:center;">{$v.lkb}</td>
				<td style="padding:10px 0;text-align:center;"><span  class="money">{$v.jb}</span></td>
				<if condition = "$v.zt eq 0">
				<td style="padding:5px 0;text-align:center;"><input class="ppid" type="hidden" value="{$v.id}">
					<button style="background-color:#05B6A3;width: 100%;height: 90% ;border: 0px;border-radius: 5px;color: #FFFFFF;cursor: pointer;" class="btnchushou">Waiting</button>
				</td>
				</if>
				<if condition = "$v.zt eq 1">
				<td style="padding:5px 0;text-align:center;"><input class="ppid" type="hidden" value="{$v.id}">
					<button style="background-color:#666;width: 100%;height: 90% ;border: 0px;border-radius: 5px;color: #FFFFFF;cursor: pointer;" >Transaction</button>
				</td>
				</if>
				<if condition = "$v.zt eq 2">
				<td style="padding:5px 0;text-align:center;"><input class="ppid" type="hidden" value="{$v.id}">
					<button style="background-color:#05B6A3;width: 100%;height: 90% ;border: 0px;border-radius: 5px;color: #FFFFFF;cursor: pointer;" class="wancheng">交易完成</button>
				</td>
				</if>
			</tr>
		</foreach>
			<!-- <tr>
				<td style="padding:10px 0;text-align:center;">三九</td>
				<td style="padding:10px 0;text-align:center;">V3</td>
				<td style="padding:10px 0;text-align:center;">100.0001</td>
				<td style="padding:10px 0;text-align:center;">100.00</td>
				<td style="padding:5px 0;text-align:center;"><input class="ppid" type="hidden" value="2"><button class="btnchushou" style="background-color:#E64340;width: 100%;height: 100% ;border: 0px;border-radius: 5px;;color: #FFFFFF;cursor: pointer;">出售</button></td>
			</tr> -->
		</tbody>
	</table>
	</div>
	<div id="chushou" style="display: none; padding-bottom:50px;background-color:#fff;">
	<form id="qiugou"style="margin-top: 25px" action="/index.php/Home/Info/encslkb" method= "POST">
		<input type="text" name="lkb" placeholder="Enter the number of sold"style="width:60%"/>
		<input type="text" name="price" placeholder="Please enter a sale price"style="width:60%"/>
		<button type="submit"style="float:right;width:33%;margin-top:-20px;background-color: #04B5A3;height: 30px;line-height: 30px;background-color: #04B5A3;height: 30px;line-height: 30px;border-radius:5px;border:0px;color:#fff">Sell</button>
	</form>
		<table class="jyzx_list" style="margin-top:20px;margin-bottom:80px;border-collapse:collapse;table-layout: fixed">
			<thead>
			<tr style="width:100%;">
				<th style="padding:10px 0">nickname</th>
				<th style="padding:10px 0">level</th>
				<th style="padding:10px 0;width:20%">GEC</th>
				<th style="padding:10px 0;">total price($)</th>
				<th style="padding:10px 0">state</th>
			</tr>
			</thead>
			<tbody>
			<foreach name="lists" item="v">
				<tr style="margin-bottom:100px">
					<td class="name" style="padding:10px 0;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space: nowrap;">{$v.p_name}</td>
					<td class="range iconfont" style="padding:10px 0;text-align:center;">
						<if condition = "$v.p_level eq 0">&#xe667;</if>
						<if condition = "$v.p_level eq 1">&#xe668;</if>
						<if condition = "$v.p_level eq 2">&#xe669;</if>
						<if condition = "$v.p_level eq 3">&#xe66a;</if>
						<if condition = "$v.p_level eq 4">&#xe64f;</if>
						<if condition = "$v.p_level eq 5">&#xe66c;</if>
						<if condition = "$v.p_level eq 6">&#xe66d;</if>


					</td>
					<td class="lkMoney" style="padding:10px 0;text-align:center;">{$v.lkb}</td>
					<td class="money" style="padding:10px 0;text-align:center;">{$v.jb}</td>
					<if condition = "$v.zt eq 0">
						<td style="padding:5px 0;text-align:center;"><input class="ppid" type="hidden" value="{$v.id}">
							<button style="background-color:#05B6A3;width: 100%;height: 90% ;border: 0px;border-radius: 5px;color: #FFFFFF;cursor: pointer;" class="btnsc">Waiting</button>
						</td>
					</if>
					<if condition = "$v.zt eq 1">
						<td style="padding:5px 0;text-align:center;"><input class="ppid" type="hidden" value="{$v.id}">
							<button style="background-color:#666;width: 100%;height: 90% ;border: 0px;border-radius: 5px;color: #FFFFFF;cursor: pointer;" >Transaction</button>
						</td>
					</if>
					<if condition = "$v.zt eq 2">
						<td style="padding:5px 0;text-align:center;"><input class="ppid" type="hidden" value="{$v.id}">
							<button style="background-color:#05B6A3;width: 100%;height: 90% ;border: 0px;border-radius: 5px;color: #FFFFFF;cursor: pointer;" class="wancheng">交易完成</button>
						</td>
					</if>
				</tr>
			</foreach>
			<!-- <tr>
				<td style="padding:10px 0;text-align:center;">三九</td>
				<td style="padding:10px 0;text-align:center;">V3</td>
				<td style="padding:10px 0;text-align:center;">100.0001</td>
				<td style="padding:10px 0;text-align:center;">100.00</td>
				<td style="padding:5px 0;text-align:center;"><input class="ppid" type="hidden" value="2"><button class="btnchushou" style="background-color:#E64340;width: 100%;height: 100% ;border: 0px;border-radius: 5px;;color: #FFFFFF;cursor: pointer;">出售</button></td>
			</tr> -->
			</tbody>
		</table>
	</div>
<!--底部开始-->
<style>
	.footer ul li{
		width: 25%;
	}
</style>
	<div class="footer">
        <ul>
            <li><a href="/index.php/Shop/Index/enindex" class="block"><i class="iconfont">&#xe604;</i>Mills Mall</a></li>
			<li><a href="/index.php/Home/Info/enmykuangche/" class="block"><i class="iconfont">&#xe601;</i>My mine</a></li>
            <li><a href="/index.php/Home/Info/enIndex" class="block"><i class="iconfont">&#xe645;</i>Trading center</a></li>
            <li style="width:24%"><a href="/index.php/Home/Index/enindex" class="block"><i class="iconfont">&#xe684;</i>Personal Center</a></li>
        </ul>
    </div>
	

		<script src="__PUBLIC__/user2/js/jquery.dataTables.min.js"></script>
		<script src="__PUBLIC__/user2/js/dataTables.bootstrap.min.js"></script>
		<script src="__PUBLIC__/user2/js/jQuery-2.1.4.min.js"></script>
		<script src="__PUBLIC__/web/js/echarts.min.js"></script>
		<script src="__PUBLIC__/user2/js/bootstrap.min.js"></script>
		<script src="__PUBLIC__/user2/js/morris.min.js"></script>
		<script src="__PUBLIC__/user2/js/raphael-min.js"></script>
	<!--底部结束-->
	<script src="__PUBLIC__/web/js/jquery-weui.min.en.js"></script>
	<script>
		function showhidediv(id) {
			console.log(id);
			var qiugou = document.getElementById("qiugou");
			var zhengzai = document.getElementById("chushou");
			var qiugoubg = document.getElementById("qiugou_list");
			var zhengzaibg = document.getElementById('chushou_list');
			if (id == "qiugou") {
				zhengzai.style.display = 'none';
				qiugou.style.display = 'block';
				qiugoubg.style.backgroundColor = "#05B6A3"
				qiugoubg.style.color = "#fff"
				zhengzaibg.style.backgroundColor = "#fff";
				zhengzaibg.style.color = "#000";
			}else if(id=='chushou'){
				zhengzai.style.display = 'block';
				qiugou.style.display = 'none';
				qiugoubg.style.backgroundColor = "#fff";
				qiugoubg.style.color = "#000";
				zhengzaibg.style.backgroundColor = "#05B6A3";
				zhengzaibg.style.color = "#fff";
			}
		}
	</script>
	<script>
	
	
		$(function(){
				var s='<div id="popUpBox" style="position:absolute;top:30%;width:100%;height:100%;display:none;background-color:#DDD">'+
						'<div style="margin:0 auto;width: 90%;height:150px;background-color: #fff;padding:15px 0 10px;border-radius: 10px">'+
						'<div style="text-align:center;font-size:1.2em;margin-top:15px;">是否确认提交？</div><input class="opid" type="hidden" value="" />'+
						'<div style="text-align:center;margin-top:35px;"><button style="font-size:1.2em;padding:5px 10px;background-color:#fff;border-radius: 5px;border: 0px;color:green"  id="confirmBtn">确认</button>&nbsp;&nbsp;<button style="padding:5px 10px;font-size:1.2em;border: 0px;background-color:#fff;border-radius: 5px" id="confirmBtnFalse">取消</button></div>'+
						'</div>'+
				'</div>';
				$("body").append(s);
		})

		$(function(){
		$(".btnchushou").bind("click",function(){


		   var huilv=$(this).parent().parent().find(".money").html();
		   $("#popUpBox").find(".opid").val($(this).parent().find(".ppid").val());
			$.ajax({
				url:"{:U('/index.php/Home/Info/huilv')}",
				type:"get",
				data:{id:$("#UpBox").find(".opid").val(),huilv:huilv},
				dataType:"json",
				success:function(data){
				console.log(data);
				$.confirm("USD($)："+huilv+"<br>"+"BTC："+data.btc,"Determine submit？",function(){	
					$.ajax({
				url:"{:U('/index.php/Home/Info/enchushou')}",
				type:"get",
				data:{id:$("#popUpBox").find(".opid").val()},
				dataType:"json",
				success:function(data){
				console.log(data);
					if(data.status==1){
					$.alert(data.msg,function(){
					   location.href="/index.php/Home/Info/enmyjiaoyi";
					});
				    }else{
					$.alert(data.msg);
					}
				},
				error:function(){
					$.alert("network error");
				}
			})
		
		})
	
				},
				error:function(){
					$.alert("network error");
				}
			})
		
		

		
		
		})



		})
		
		
	</script>
	
	
	<!--价格走势图开始-->
<script type="text/javascript">
    //数据处理函数
    function setData(type,data){
        //type=1为分时线数据
        var dd={};
        dd.time=[];
        dd.data=[];
        for(var i=0;i<data.length;i++){
         var time=data[i].date[11]+data[i].date[12]+data[i].date[13]+data[i].date[14]+data[i].date[15];
         dd.time.push(time);
             if(i==0){
                 if(data[i].danjia==null){
                     for(var z=0;z<data.length;z++){
                         if(data[z].danjia!=null){
                             data[i].danjia=data[z].danjia;
                         }
                     }
                 }
             }
             if(type==1){
             dd.data.push(data[i].danjia);
             dd.data[i]=dd.data[i]==null?dd.data[i-1]:dd.data[i];
            }else{
               dd.data[i]=[];
                 //dd.data[i].push(data[i].danjia);
                 //dd.data[i].push(0);
                 //dd.data[i].push(0);
                 //dd.data[i].push(0);
                 //dd.data[i][0]=dd.data[i][0]==null?dd.data[i-1][0]:dd.data[i][0];
                 //dd.data[i][1]=dd.data[i][1]==null?dd.data[i-1][3]:dd.data[i][1];
                 //dd.data[i][2]=dd.data[i][2]==null?dd.data[i-1][2]:dd.data[i][2];
                 //dd.data[i][3]=dd.data[i][3]==null?dd.data[i-1][1]:dd.data[i][3];

             }
        }
        return dd;
        //type=2为为其他类型的数据

    }
    //不同现行的请求控制
    function line(id,myChart,option){
        //请求数据
        myChart.showLoading();
        $.ajax({
            type : "POST",
            url : "{:U('/index.php/Home/Ajax/getgp')}",
            data : null,
            dataType : "json",
            success : function(data) {
                //console.log(data);
                if(id==1){
                    option.series.type="line";
                    option.tooltip.formatter=function (param) {
                        //console.log(param);
                        return param[0].name+'price '+param[0].data;
                    }
                }else{
                    option.series.type="candlestick";
                    option.tooltip.formatter=function (param) {
                        return 'time'+param[0].name+'<br/>'+
                                'This open'+param[0].name;
                    }
                }
                option.xAxis.data=setData(id,data).time;
                option.series.data=setData(id,data).data;
                //console.log(option.series.data);
                myChart.setOption(option);
            },
            error:function(){
                $.alert("Network Error");
            },
            complete:function(){
                myChart.hideLoading();
            }
        });
    }

    $(function(){
//获取图表
    var myChart = echarts.init(document.getElementById('main'));
//    商城配置信息
    var option={
        //背景颜色
        backgroundColor:'#EFEFF4',
        //提示框设置
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                animation: true,
                lineStyle: {
                    color: '#376df4',
                    width: 2,
                    opacity: 1
                }
            }
        },
        //数据轴设置
        xAxis: {
            type: 'category',
            data: [],
            boundaryGap:true,
            axisLine: { lineStyle: { color: '#8392A5' } }
        },
        //坐标轴设置
        yAxis: {
            scale: true,
            boundaryGap:false,
            axisLine: { lineStyle: { color: '#8392A5' } },
            splitLine: { show: false }
        },
        //图表类型设置
        series:{
            type:'line',
            data:[],
            itemStyle: {
                normal: {
                    color: '#FD1050',
                    color0: '#0CF49B',
                    borderColor: '#FD1050',
                    borderColor0: '#0CF49B'
                }
            }
        },
        //缩放设置
        dataZoom: [
            {
                type: 'slider',
                show: true,
                xAxisIndex: [0],
                start: 70,
                end: 100
            },
            {
                type: 'inside',
                xAxisIndex: [0],
                start: 70,
                end: 100
            }
        ]
    }
    //加载默认图标
        line(1,myChart,option);
    //        高亮设置
    $("#lineType a").bind("click",function(){
        $("#lineType a").removeClass("active");
        $(this).addClass('active');
        line($(this).attr("data-id"),myChart,option);
    });
//请求数据
    })
</script>
<!--价格走势图结束-->
	
	
	
	<script>
	$(function(){
				var s='<div id="UpBox" style="position:absolute;top:30%;width:100%;height:100%;display:none;background-color:#DDD">'+
						'<div style="margin:0 auto;width: 90%;height:150px;background-color: #fff;padding:15px 0 10px;border-radius: 10px">'+
						'<div style="text-align:center;font-size:1.2em;margin-top:15px;">是否确认提交？</div><input class="opid" type="hidden" value="" />'+
						'<div style="text-align:center;margin-top:35px;"><button style="font-size:1.2em;padding:5px 10px;background-color:#fff;border-radius: 5px;border: 0px;color:green"  id="firmBtn">确认</button>&nbsp;&nbsp;<button style="padding:5px 10px;font-size:1.2em;border: 0px;background-color:#fff;border-radius: 5px" id="confirmBtnFalse">取消</button></div>'+
						'</div>'+
				'</div>';
				$("body").append(s);
		})
	$(function(){



		$(".btnsc").bind("click",function(){



		   var huilv=$(this).parent().parent().find(".money").html();
		   $("#popUpBox").find(".opid").val($(this).parent().find(".ppid").val());
			$.ajax({
				url:"{:U('/index.php/Home/Info/huilv')}",
				type:"get",
				data:{id:$("#UpBox").find(".opid").val(),huilv:huilv},
				dataType:"json",
				success:function(data){
				console.log(data);
				$.confirm("USD($)："+huilv+"<br>"+"BTC："+data.btc,"Determine submit？",function(){	
					$.ajax({
				url:"{:U('/index.php/Home/Info/enlksc')}",
				type:"get",
				data:{id:$("#popUpBox").find(".opid").val()},
				dataType:"json",
				success:function(data){
				console.log(data);
					if(data.status==1){
					$.alert(data.msg,function(){
					   location.href="/index.php/Home/Info/enmyjiaoyi";
					});
				    }else{
					$.alert(data.msg);
					}
				},
				error:function(){
					$.alert("network error");
				}
			})
		
		})
	
				},
				error:function(){
					$.alert("network error");
				}
			})
		
		

		
		
		})




		})
	</script>
	<!-- 汇率转换 -->
	<script>
    $(function(){
		$(".money").bind("click",function(){
			var huilv=$(this).html();
			$.ajax({
				url:"{:U('/index.php/Home/Info/huilv')}",
				type:"get",
				data:{id:$("#UpBox").find(".opid").val(),huilv:huilv},
				dataType:"json",
				success:function(data){
				console.log(data);
					$.modal({
                        title: data.name,
                        text: "USD："+huilv+"<br>"+"BTC："+data.btc,
                        buttons:[
                            { text: "confirm", className: "default", onClick: function(){ } },
                        ]
                    })
				},
				error:function(){
					$.alert("网络错误请重试");
				}
			})
		})
		$("#firmBtnFalse").bind("click",function(){
			$("#UpBox").fadeOut();
		})
		})
</script>
<if condition="$_SESSION['secpwd'] eq ''">
			<script>
			$(function(){
			$.prompt("Please enter a secure password","",function(){
			   $.ajax({
			   url:"{:U('/index.php/Home/Info/enerjimima')}",
			   type:"get",
			   data:{pwd:$("#weui-prompt-input").val()},
			   dataType:"json",
			   success:function(data){
			   if(data.status==1){
			   $.alert(data.msg);
			   }else{
			   $.alert(data.msg,function(){
			   location.href=location.href;
			   });
			   }
			   },error:function(){
			   $.alert("网络错误",function(){
			   history.back(-1);
			   });
			   }
			   })
			},function(){
			history.back(-1);
			},1)
			})
			</script>
	</if>
</body>
</html>